package org.kzwl.book.controller.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.kzwl.comm.pojo.ResponseData;
import org.kzwl.comm.pojo.bo.SaveCuCarouselBO;
import org.kzwl.entity.web.CuCarousel;
import org.kzwl.entity.web.CuVisit;
import org.kzwl.service.web.CuCarouselService;
import org.kzwl.service.web.CuVisitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张国伟/郭家恒
 * @since 2020-12-22
 */
@Api("轮播图")
@RestController
@RequestMapping("/cu-carousel")
public class CuCarouselController {

    @Autowired
    CuCarouselService cuCarouselService;
    @Autowired
    CuVisitService cuVisitService;

    @PostMapping("/queryPage")
    public ResponseData<IPage<CuCarousel>> queryPage(@RequestBody SaveCuCarouselBO cuCarouselBO)
    {
        return cuCarouselService.queryPage(cuCarouselBO);
    }

    @PostMapping("/saveOne")
    public ResponseData<Void> saveOne(@RequestBody @Valid SaveCuCarouselBO cuCarouselBO)
    {
        return cuCarouselService.saveOne(cuCarouselBO);
    }

    @PostMapping("/updateOne")
    public ResponseData<Void> updateOne(@RequestBody SaveCuCarouselBO cuCarouselBO)
    {
        return cuCarouselService.updateOne(cuCarouselBO);
    }

    @PostMapping("/queryOne")
    public ResponseData<CuCarousel> queryOne(@RequestBody Long Id)
    {
        return cuCarouselService.queryOne(Id);
    }

    @PostMapping("/deleteId")
    public ResponseData<Void> deleteId(@RequestBody Long Id)
    {
        return cuCarouselService.deleteId(Id);
    }

    @ApiOperation(value = "首页轮播图",notes = "ID为场馆ID")
    @GetMapping("/queryList")
    public ResponseData<List<CuCarousel>> queryList(Long Id)
    {
        return cuCarouselService.queryList(Id);
    }

    public static void main(String[] args) {
        HashMap<String,Object> hashMap  = new HashMap<>();
    }
}
